package demo1;

//工人：具体的实现类
public class Worker extends Builder {
    private Product product;
    //添加构造函数

    public Worker() {
       //不采用传入的方式 this.product = product;，需要自己new一个，即工人创建产品
        product = new Product();
    }


    @Override
    Builder buildA(String msg) {
        product.setBuildA(msg);
        return this;
    }

    @Override
    Builder buildB(String msg) {
        product.setBuildB(msg);
        return this;
    }

    @Override
    Builder buildC(String msg) {
        product.setBuildC(msg);
        return this;
    }

    @Override
    Builder buildD(String msg) {
        product.setBuildD(msg);
        return this;
    }

    @Override
    Product getProduct() {
        return product;
    }
}
